import request from './request'

export const getWishlist = () => {
  return request({
    url: '/api/wishlist',
    method: 'get'
  }).then(res => Array.isArray(res.data) ? res.data : [])
}

export const addToWishlist = (cityId) => {
  return request({
    url: '/api/wishlist',
    method: 'post',
    data: { cityId }
  })
}

export const removeFromWishlist = (cityId) => {
  return request({
    url: `/api/wishlist/${cityId}`,
    method: 'delete'
  })
}